package oer.halk.intercept_demo.intercept;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 将自定义拦截器加入配置当中
 *
 * @Author zhuhao
 * @Date 2022/1/26 15:07
 * @desc
 */
@Configuration
public class CustomWebMvcConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(new CustomIntercept()).addPathPatterns("/**");
        registry.addInterceptor(new LogIntercept()).addPathPatterns("/**");
        WebMvcConfigurer.super.addInterceptors(registry);
    }
}
